﻿using System.Web;

namespace Repo.Helpers
{
    public static class ContextHelper
    {
        public static HttpRequest Request
        {
            get
            {
                HttpContext context = HttpContext.Current;
                if (context == null) return null;

                if (HttpRuntime.UsingIntegratedPipeline)
                {
                    try { return context.Request; }
                    catch { /* Consume or log exception */ return null; }
                    // Do not use message comparison - .NET translates messages for multi-culture environments.
                }

                return context.Request;
            }
        }
    }

}
